package com.terrynoya.fight.stateMachine.controllers
{
	import com.terrynoya.fight.char.Character;
	import com.terrynoya.fight.char.Entity;
	import com.terrynoya.fight.emuns.PlayerControl;
	import com.terrynoya.fight.stateMachine.StateController;
	import com.terrynoya.fight.stateMachine.controllers.attrParser.StateCtrlParserType;
	
	public class CtrlSet extends StateController
	{
		public function CtrlSet(name:String)
		{
			super(name);
		}
		
		override protected function initAttrConvertMap():void
		{
			this.attrConvertMap.put("value",StateCtrlParserType.Expression);
		}
		
		override public function run(character:Character):void
		{
			var ctrl:Boolean = Boolean(this.getExpression("value").excute(character));
			if(ctrl == true)
			{
				character.playerControl = PlayerControl.InControl;
			}
			else
			{
				character.playerControl = PlayerControl.NoControl;	
			}
		}
	}
}